package demo3;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

@Component
public class Person {
    @Autowired
    @Qualifier("winter")
    private Clothes clothes;

    public void play() {
        //穿衣服出去玩
        //正常方法：实例化依赖的类
        //调用该类的功能
//        Sweater sweater = new Sweater();
//        sweater.wear();
        //如果更换成其他类，则需要修改源代码
//        Shirt shirt = new Shirt();
//        shirt.wear();
        clothes.wear();
        System.out.println("出去玩");
    }
}
